fix(sdk-coin-polyx, abstract-substrate): fix withdrawal local validation after chain upgrade#9207
Merged
nvrakesh06 merged 1 commit intoJul 9, 2026
Conversation
Contributor
49a09c9 to
6902983
Compare
There was a problem hiding this comment.
Pull request overview
This PR fixes Polymesh (POLYX) client-side transaction validation failures after a chain upgrade by ensuring transaction decoding uses the correct chain metadata, and by improving v8 transaction builder routing as a fallback.
Changes:
- Update
abstract-substrateverifyTransactionto prefertxPrebuild.coinSpecific.material(live chain material embedded by the server) for decoding before calling.from(txHex). - Extend
sdk-coin-polyxtryGetV8Builderto route additional non-staking v8 transactions (e.g.,transferWithMemo,registerDid,preApproveAsset,addAndAffirmWithMediators) to v8 builders. - Add unit tests covering v8 builder routing and
verifyTransactionbehavior whencoinSpecific.materialis provided.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| modules/sdk-coin-polyx/test/unit/transactionBuilder/transactionBuilderFactory.ts | Adds unit tests to assert v8 transferWithMemo transactions route to the correct v8 builders via fallback. |
| modules/sdk-coin-polyx/test/unit/polyx.ts | Adds unit tests verifying verifyTransaction succeeds/fails correctly for v8 transfers when coinSpecific.material is provided. |
| modules/sdk-coin-polyx/src/lib/transactionBuilderFactory.ts | Expands v8 fallback routing to cover additional non-staking transaction types and memo-encoding variants. |
| modules/abstract-substrate/src/abstractSubstrateCoin.ts | Uses embedded live-chain material (when present) to decode transactions correctly during local validation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
When the server builds a transfer tx against v8 chain metadata, the client-side v7 decode fails (call indices shifted) and falls through to tryGetV8Builder. Route transferWithMemo, addAndAffirmWithMediators, registerDid/WithCDD, and preApproveAsset to their v8 builders. Pass coinSpecific.material from txPrebuild to the transaction builder factory before from() so local validation uses live-chain pallet/call mapping instead of stale hardcoded metadata. Add unit tests for v8 transfer routing and material propagation. Ticket: CECHO-1471 Co-authored-by: Cursor <cursoragent@cursor.com>
b89e1f4 to
36d878b
Compare
venkateshv1266
approved these changes
Jul 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Treasury), while the server builds transactions against live RPC metadata (where 0x28 is nowBalances). This causesverifyTransactionto misreadbalances.transferWithMemoastreasury.disbursementand fail.Wallet.prebuildAndSignTransactionin the browser, which callsverifyTransactionlocally with the hardcoded SDK material.abstract-substrate):verifyTransactionnow readstxPrebuild.coinSpecific.material(the live chain material the server embeds during prebuild) and passes it to the factory before.from(txHex). This gives the factory the correct pallet mapping for the current chain spec.sdk-coin-polyx):tryGetV8Buildernow routes v8-encoded non-staking transactions (transferWithMemo, addAndAffirmWithMediators, registerDid, preApproveAsset) to their v8 builders. Defense-in-depth for cases where coinSpecific.material is absent or stale.Root Cause Detail
Test plan
verifyTransactionwith a txHex whose pallet index only resolves correctly with the material incoinSpecific.materialtryGetV8BuilderroutestransferWithMemotoV8TransferBuildertpolyxwithdrawal end-to-end confirms local validation passesLinear: CECHO-1471
🤖 Generated with Claude Code